using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HengTong.Model.Db.Hr.Attendance;
using HengTong.ViewModel.Hr.SysAttendanceShiftGroupVms;

namespace HengTong.ViewModel.Hr.SysAttendanceRecordVms;

public class SysAttendanceRecordView : SysAttendanceRecord{
    [Display(Name = "姓名")]
    public String PersonName { get; set; }
        
    [Display(Name = "班组名称")]
    public String AttendanceShiftGroupName { get; set; }
        
    [Display(Name = "替班人员")]
    public String SubstitutePersonName { get; set; }

    [Display(Name = "班次颜色")]
    public string DisplayColor { get; set; }
    
    [Display(Name = "班次信息")]
    public string ShiftInfo { get; set; }
    
    // 新增:支持多班次信息
    [Display(Name = "班次详情列表")]
    public List<ShiftDetailInfo> ShiftDetails { get; set; }
    
    public TimeSpan WorkEndTime { get; set; }
    
    public TimeSpan WorkStartTime { get; set; }
    
    /// <summary>
    /// 获取或设置标准工作时长
    /// </summary>
    /// <value>班次的标准工作时长，单位为分钟</value>
    [Display(Name = "标准工作时长(分钟)", Description = "班次的标准工作时长", GroupName = "工时折算")]
    public int StandardWorkMinutes { get; set; } = 570; // 9小时30分钟

    /// <summary>
    /// 获取或设置工时折算出勤天数
    /// </summary>
    /// <value>完成标准工时对应的出勤天数，用于计算出勤率</value>
    [Display(Name = "折算出勤天数", Description = "完成标准工时对应的出勤天数", GroupName = "工时折算")]
    [Range(typeof(decimal), "0", "1000", ErrorMessage = "折算出勤天数必须在0-1000之间")]
    public decimal AttendanceDays { get; set; } = 1m;
}

// 新增班次详情类
public class ShiftDetailInfo
{
    public string ShiftName { get; set; }
    public string DisplayColor { get; set; }
    public TimeSpan WorkStartTime { get; set; }
    public TimeSpan WorkEndTime { get; set; }
    public int StandardWorkMinutes { get; set; }
    public decimal AttendanceDays { get; set; }
}